@echo off
set /a RandomNumber=%random%%%100000+1

set RWcommunity=private

set routerip=172.16.104.1

set tftpip=172.16.104.144

set filename=test%RandomNumber%.cfg

pause

echo start copy configurations to and from cisco devices using snmp,  please wait a minutes!

snmpset -v 1 -c %RWcommunity% %routerip% .1.3.6.1.4.1.9.9.96.1.1.1.1.2.%RandomNumber% i 1
snmpset -v 1 -c %RWcommunity% %routerip% .1.3.6.1.4.1.9.9.96.1.1.1.1.3.%RandomNumber% i 3
snmpset -v 1 -c %RWcommunity% %routerip% .1.3.6.1.4.1.9.9.96.1.1.1.1.4.%RandomNumber% i 1
snmpset -v 1 -c %RWcommunity% %routerip% .1.3.6.1.4.1.9.9.96.1.1.1.1.5.%RandomNumber% a %tftpip%
snmpset -v 1 -c %RWcommunity% %routerip% .1.3.6.1.4.1.9.9.96.1.1.1.1.6.%RandomNumber% s %filename%
snmpset -v 1 -c %RWcommunity% %routerip% .1.3.6.1.4.1.9.9.96.1.1.1.1.14.%RandomNumber% i 1

pause

set /a count=0

:loop
if %count% == 1 goto endloop
        set /a count=%count%+1
        echo Result: ConfigCopyState(1:waiting 2:running 3:successful 4:failed) count=%count%
        snmpget -v 1 -c %RWcommunity% %routerip% .1.3.6.1.4.1.9.9.96.1.1.1.1.10.%RandomNumber%
        goto loop
:endloop

echo end copy configurations to and from cisco devices using snmp!
pause